package com.javabasic.proxy.dynamic_proxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @Author xiongmin
 * @Description //TODO
 * @Date 2020/5/31 23:27
 * @Version 1.0
 **/
public class CuctomTestDynamicProxyHandler implements InvocationHandler {

    private Object target;

    public CuctomTestDynamicProxyHandler(Object target) {
        this.target = target;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("开始记录日志");
        Object invokeResult = method.invoke(target, args);
        System.out.println("结束记录日志");
        return invokeResult;
    }
}
